#include <AppModel/Include/TimeMeter.h>

TimeMeter::TimeMeter(void)
{
	QueryPerformanceCounter(&start_counter);
	if(!QueryPerformanceFrequency( &perf_clock_frequency_ticks_per_second ))
		throw 1; //no tengo el performance counter
    
}

TimeMeter::~TimeMeter(void)
{
}

void TimeMeter::start()
{
	QueryPerformanceCounter(&start_counter);
}

double TimeMeter::end()
{
	LARGE_INTEGER end_counter;
	QueryPerformanceCounter(&end_counter);
	
	double elapsed_time = (double)(end_counter.QuadPart - start_counter.QuadPart)/(double)perf_clock_frequency_ticks_per_second.QuadPart;
	
	return elapsed_time * 1000.0;
}
